#include "../../include/GlobalMemory.hpp"

/************************************************************************/
/* kernel                                                               */
/************************************************************************/
__global__ void incrementArrayOnDevice(float *a, int N)
{
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if (idx < N) 
		a[idx] = a[idx] - 99.0f;
}

void launchKernel(CH::GlobalMemory<float>& a_d)
{
	int N = a_d.size();

	/// run kernel
	int blockSize = 4;
    int nBlocks = N/blockSize + (N%blockSize == 0?0:1);
	incrementArrayOnDevice <<< nBlocks, blockSize >>> (a_d.get_memory_ptr(), a_d.size());

}